/*
 * @Author: luojianfeng
 * @Date: 2022-07-29 10:20:58
 * @LastEditTime: 2022-12-16 10:31:23
 * @LastEditors: luojianfeng
 * @Description:
 */
// 二次确认框工具
// 调用后通过.then 和 .catch 调用成确认和取消
// name 名字  iconfont图标 title提示标题  content 提示内容 rubyText 附注内容
import { h } from 'vue'
export default class elConfim {
  static confim(data: {
    iconfont?: string
    title?: string
    content?: string
    confirmButtonText?: string
    cancelButtonText?: string
    rubyText?: string
    iconColor?: string
  }) {
    const {
      iconfont,
      title,
      content,
      confirmButtonText,
      cancelButtonText,
      rubyText,
      iconColor
    } = data
    return ElMessageBox.confirm('', {
      dangerouslyUseHTMLString: true,
      distinguishCancelAndClose: true,
      confirmButtonText: confirmButtonText || '确定',
      cancelButtonText: cancelButtonText || '取消',
      cancelButtonClass: 'btn-custom-cancel-right',
      title: title || '提示',
      message: h('div', { style: 'text-align: center;padding:40px 0px;' }, [
        h(
          'div',
          { style: 'display:flex;align-items:center;justify-content: center;' },
          [
            h('i', {
              class: `iconfont ${iconfont || 'icon-jinggao'}`,
              style: `color:${
                iconColor || '#FAAD14'
              };font-size:18px;vertical-align: top;`
            }),
            h(
              'span',
              {
                style:
                  'text-align:left;display: inline-block; max-width:350px;vertical-align: top; color: rgba(41, 51, 78, 0.85);font-size:16px; vertical-align: middle; margin-left:7px;'
              },
              `${content || '内容'}`
            )
          ]
        ),
        h(
          'div',
          {
            style:
              'margin-top:10px;color:rgba(41, 52, 78, 0.65);font-size:14px;'
          },
          rubyText
        )
      ])
    })
  }
}
